package com.mlegrand.firestarter.managers
{
	import com.mlegrand.firestarter.util.write.WriteContentFiles;
	import com.mlegrand.firestarter.util.write.WriteNavFiles;
	import com.mlegrand.firestarter.util.write.WriteProjectFiles;
	import com.mlegrand.firestarter.view.popups.TopSlideDownNotification;
	
	import mx.core.Application;
	
	[Bindable]
	public class ProjectBuilderManager
	{
		
		
		////////////////////////////////////////////////////////////////////////////
		// public static consts
		////////////////////////////////////////////////////////////////////////////
		
		////////////////////////////////////////////////////////////////////////////
		// properties
		////////////////////////////////////////////////////////////////////////////

		public var clientName:String;
		public var projectName:String;
		public var location:String;
		public var sectionsArray:Array = new Array();
		public var contentVisible:Boolean = true;
		public var continueToOne:Boolean;
		public var isAnAirApp:Boolean;
		
		
		////////////////////////////////////////////////////////////////////////////
		// constructor
		////////////////////////////////////////////////////////////////////////////
		
		
		public function ProjectBuilderManager(){}
		
		
		
		
		////////////////////////////////////////////////////////////////////////////
		// methods
		////////////////////////////////////////////////////////////////////////////
		
		public function buildApplication():void
		{
			var writeProjectFiles:WriteProjectFiles = new WriteProjectFiles(location, projectName, clientName);
			writeProjectFiles.write();
			
			var writeContent:WriteContentFiles = new WriteContentFiles(location, projectName, clientName, sectionsArray)
			writeContent.write();

			var w:WriteNavFiles = new WriteNavFiles(location, projectName, clientName, sectionsArray);
			w.write();
			
			dispatchPopupWindow();
		}
		
		
		protected function dispatchPopupWindow():void
		{
			var dropDown:TopSlideDownNotification = new TopSlideDownNotification();
			Application.application.mainView.addChildAt(dropDown, 1);
			dropDown.move((Application.application.mainView.width/2 - dropDown.width/2), Application.application.mainView.header.height -10);
			dropDown.show();
		}

	}
}